﻿using System.Collections.Generic;
using System.Windows.Controls;

namespace Me.Amon.Pcs.V
{
    /// <summary>
    /// UcTab.xaml 的交互逻辑
    /// </summary>
    public partial class TabHead : UserControl
    {
        private WPcs _WPcs;
        private List<TabPage> _Pages = new List<TabPage>();

        public TabHead()
        {
            InitializeComponent();

            SelectedIndex = -1;
        }

        public TabHead(WPcs wPcs)
        {
            _WPcs = wPcs;
            SelectedIndex = -1;

            InitializeComponent();
        }

        #region 公共函数
        public void AddPage(string name, string text, TabPage page)
        {
            _Pages.Add(page);
            if (SelectedIndex < 0)
            {
                SelectedIndex = 0;
                SelectedPage = _Pages[SelectedIndex];
            }
        }

        public void AddPage(string text, TabPage page)
        {
            _Pages.Add(page);
            if (SelectedIndex < 0)
            {
                SelectedIndex = 0;
                SelectedPage = _Pages[SelectedIndex];
                _WPcs.ShowPage(SelectedPage);
            }
        }

        public void RmovePage(string name)
        {
        }

        public void RemovePage(TabPage page)
        {
        }

        public void RemovePageAt(int index)
        {
        }

        public TabPage SelectedPage { get; set; }

        public int SelectedIndex { get; set; }
        #endregion
    }
}
